const { RESTDataSource } = require('apollo-datasource-rest')

class DouBanApi extends RESTDataSource{
    constructor() {
        super()
        this.baseURL = "https://api.douban.com/v2/book/"
    }

    async getBook(keywords) {
        const result = await this.get(`/search?q=${keywords}&count=30`)
        return result.books
    }
}

module.exports = DouBanApi